package com.greyu.ysj.service.impl;


import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.greyu.ysj.config.ResultStatus;
import com.greyu.ysj.entity.CbtCoinPrice;
import com.greyu.ysj.mapper.CbtCoinPriceMapper;
import com.greyu.ysj.model.ResultModel;
import com.greyu.ysj.service.CbtCoinPriceService;

@Service
@Transactional
public class CbtCoinPriceServiceImpl implements CbtCoinPriceService {
	@Autowired
	private CbtCoinPriceMapper cbtCoinPriceMapper;

	@Override
	public ResultModel save(CbtCoinPrice cbtCoinPrice) {
		if(cbtCoinPrice.getCoinId() == null || cbtCoinPrice.getCoinPriceRmb() == null) {
			 return ResultModel.error(ResultStatus.DATA_NOT_NULL);
		}
		cbtCoinPrice.setCreateDate(new Date());
		this.cbtCoinPriceMapper.insert(cbtCoinPrice);
		return ResultModel.ok(cbtCoinPrice);
	}

	
	
}

